home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_mardukwhip.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  289 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_MardukWhip.cog
  4. #
  5. # [TL, RT & HB]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ==============================================================================
  9.  
  10. symbols
  11.  
  12. message        startup
  13. message        damaged
  14. message        callback
  15.  
  16. keyframe    in_whip_up=in_whip_topprobe.key        local
  17. keyframe    in_ravel=in_attack_ravel_whip.key    local
  18. keyframe    wh_whip_up=wh_whip_topprobe.key        local
  19. keyframe    wh_ravel=wh_attack_whip_ravel.key    local
  20.  
  21. model        whipHand=weap_whip.3do                local
  22.  
  23. sound        unroll=gen_whip_unravel.wav            local
  24. sound        snap=gen_whip_fire.wav                local
  25. sound        zap=aet_whip_crack.wav                local
  26. sound        roll=gen_whip_ravel.wav                local
  27. sound        full=INXJ112.WAV                    local
  28. sound        charge=aet_mr_chargeup.wav            local
  29.  
  30. template    whipTpl=+whip_actor                    local
  31. template    tpl_ghost=ghost                        local
  32. template    sparks0=mophiaSparksLg                local
  33. template    chargesprite=+tower_glow            local
  34.  
  35. sector        camsector                            local
  36.  
  37. thing        player                                local
  38. thing        whipThing                            local
  39.  
  40. thing        indy                                    
  41. thing        probe
  42. thing        m_cam1spot                            nolink
  43. thing        m_cam1look                            nolink
  44.  
  45. thing        offcam                                local
  46. thing        offtarg                                local
  47. thing        spritespot
  48.  
  49. vector        v_camspot                            local
  50.  
  51. flex        endScene                            local
  52.  
  53. int            curcam                                local
  54. int            curSound                            local
  55. int            damageType                            local
  56. int            sender                                local
  57. int            callNum                                local
  58. int            joint                                local
  59. int            offcamexists=0                        local
  60. int            probactive=0                        local
  61. int            bSpoken=0                            local
  62. int            sprite0                                local
  63.  
  64. cog            doortalk
  65.  
  66. end
  67.  
  68. # ==============================================================================
  69.  
  70. code
  71.  
  72. startup:
  73.  
  74.     player = GetLocalPlayerThing();
  75.     global6 = 0;
  76.  
  77.     return;
  78.  
  79. # ..............................................................................
  80.  
  81. damaged:
  82.  
  83.     # Charge whip here...
  84.     if (GetSenderRef() == probe)
  85.     {
  86.         if (probactive != 0)
  87.         {
  88.             return;
  89.         }
  90.         probactive = 1;
  91.  
  92.         damageType = GetParam(1);
  93.         if ((damageType != 0x10) && (damageType != 0x800)) return;
  94.  
  95.         if (GetInv(player, 2) < 25)
  96.         {
  97.             bSpoken = 0;
  98.         }
  99.  
  100.         if (global6 == 0)
  101.         {
  102.             global6 = 1;
  103.         }
  104.  
  105.         # Prep...
  106.         if (MakeMeStop() == -1) return;
  107.  
  108.         SetActorFlags(player, 0x200000);
  109.         StartCutScene(0);
  110.  
  111.         CopyPlayerHolsters(player, indy);
  112.         ClearThingFlags(indy, 0x80000);
  113.         TeleportThing(indy, player);
  114.         SetThingFlags(player, 0x80000);
  115.  
  116.         # Set up camera...
  117.         if (offcamexists != 0)
  118.         {
  119.             DestroyThing(offcam);
  120.             DestroyThing(offtarg);
  121.         }
  122.         v_camspot = VectorAdd(VectorTransformToOrient(indy, '-0.5 0.3 0.6'), GetThingPos(indy));    
  123.         camsector = FindNewSectorFromThing(indy, v_camspot);
  124.         offcam = CreateThingAtPos(tpl_ghost, camsector, v_camspot, '0 0 0');
  125.         CaptureThing(offcam);
  126.  
  127.         v_camspot = VectorAdd(VectorTransformToOrient(indy, '0.0 0.05 0.2'), GetThingPos(indy));    
  128.         camsector = FindNewSectorFromThing(indy, v_camspot);
  129.         offtarg = CreateThingAtPos(tpl_ghost, camsector, v_camspot, '0 0 0');
  130.         CaptureThing(offtarg);
  131.         offcamexists = 1;
  132.     
  133.         ResetCameraFOV(0, 0.0);
  134.         MakeCamera2LikeCamera1(m_cam1spot, m_cam1look);
  135.         SetCameraLookInterp(2, 0);
  136.         SetCameraPosInterp(2, 0);
  137.         SetCameraFocus(2, m_cam1spot);
  138.         SetCameraSecondaryFocus(2, m_cam1look);
  139.         SetCurrentCamera(2);
  140.         ResetCameraFOV(0, 0.0);
  141.         SetCameraLookInterp(2, 1);
  142.         SetCameraPosInterp(2, 1);
  143.         SetCameraInterpSpeed(2, 1.5);
  144.         Sleep(0.01);
  145.  
  146.         # Slide cam out...
  147.         SetCameraFocus(2, offcam);
  148.         SetCameraSecondaryFocus(2, offtarg);
  149.  
  150.         # Prep whip...
  151.         whipThing = AttachThingToThingMesh(indy, whipTpl, 15);
  152.         SetThingMesh(indy, 15, whipHand, 0);
  153.  
  154.         # Do that whip thang...
  155.         PlayKey(indy, in_whip_up, 2, 0x12, 0);        # Indy anim...
  156.         PlayKey(whipThing, wh_whip_up, 2, 0x12, 0);    # Whip anim...
  157.  
  158.         # Play the unravel sound...
  159.         curSound = PlaySoundThing(unroll, indy, 1, -1, -1, 0x80);
  160.         WaitForSound(curSound);
  161.         Sleep(0.25);
  162.         
  163.         # Play the appropriate fire sound and increment bin...
  164.         if (BitTest(GetActorFlags(player), 0x40000000)) # Electric whip
  165.         {
  166.             if (GetInv(player, 2) < 25)
  167.                 {
  168.                 PlaySoundThing(charge, indy, 1, -1, -1, 0x80);
  169.                 CreateThing(sparks0, probe);
  170.                 CreateThing(sparks0, probe);
  171.                 sprite0 = CreateThing(chargesprite, spritespot);
  172.                 AnimateSpriteSize(sprite0, '0.25 0.25 1.0', '0.35 0.35 0.0', 1.0);
  173.                 }
  174.             ChangeInv(player, 2, 5); # Add 5 shots to the whip bin...
  175.         }
  176.         else
  177.         {
  178.             PlaySoundThing(charge, indy, 1, -1, -1, 0x80);
  179.             CreateThing(sparks0, probe);
  180.             CreateThing(sparks0, probe);
  181.             sprite0 = CreateThing(chargesprite, spritespot);
  182.             
  183.             AnimateSpriteSize(sprite0, '0.25 0.25 1.0', '0.35 0.35 0.0', 1.0);
  184.             SetWhipElectric(1);
  185.             ChangeInv(player, 2, 4); # Add 4 shots to the whip bin...already has 1
  186.         }    
  187.     }
  188.  
  189.     return;
  190.  
  191. # ..............................................................................
  192.  
  193. callback:
  194.  
  195.     sender = GetSenderRef();
  196.     callNum = GetParam(1);
  197.  
  198.     if (sender == indy)
  199.     {
  200.         ReleaseThing(indy);
  201.  
  202.         if (callNum == 24)
  203.         {
  204.             # Start wind-ups...
  205.             PlayKey(indy, in_ravel, 4, 0x12, 0);
  206.             if (whipThing != -1)
  207.             {
  208.                 CaptureThing(whipThing);
  209.                 PlayKey(whipThing, wh_ravel, 4, 0x12, 0);
  210.             }
  211.  
  212.             PlaySoundThing(roll, indy, 1, -1, -1, 0x80);
  213.         }
  214.     }
  215.     else if (sender == whipThing)
  216.     {
  217.         if (callNum == 28)
  218.         {
  219.             for (joint = 12; joint > 4; joint = joint - 1)
  220.             {
  221.                 AmputateJoint(whipThing, joint);
  222.             }
  223.         }
  224.         else if (callNum == 29)
  225.         {
  226.             AmputateJoint(whipThing, 4);
  227.         }
  228.         else if (callNum == 30)
  229.         {
  230.             AmputateJoint(whipThing, 3);
  231.         }
  232.         else if (callNum == 31)
  233.         {
  234.             ReleaseThing(whipThing);
  235.             AmputateJoint(whipThing, 2);
  236.  
  237.             if (whipThing != -1)
  238.             {
  239.                 DetachThingMesh(whipThing);
  240.                 SetWeaponModel(indy, 2); 
  241.             }
  242.             whipThing = -1;
  243.  
  244.             call endScene;
  245.         }
  246.     }
  247.  
  248.     return;
  249.  
  250. # ..............................................................................
  251.  
  252. endScene:
  253.  
  254.     if (GetInv(player, 2) == 25)
  255.     {
  256.         if (!bSpoken)
  257.         {
  258.             bSpoken = 1;
  259.             PlayVoice(indy, full, 1.0, 1); # "That oughta do it"
  260.         }
  261.         else
  262.         {
  263.             SendMessageEx(doorTalk, user3, player, 0, 0, 0);
  264.             while (global15 == 0)
  265.             {
  266.                 # Wait for line to finish...
  267.                 Sleep(0.01);
  268.             }
  269.         }
  270.     }
  271.  
  272.     # Cleanup...
  273.     SetThingFlags(indy, 0x80000);
  274.     ClearThingFlags(player, 0x80000);
  275.     
  276.     v_camspot = VectorAdd(VectorTransformToOrient(player, '-0.18 0.0 0.1'), GetThingPos(player));
  277.     SetCameraPosition(1, v_camspot);
  278.     
  279.     SetCurrentCamera(1);
  280.     ResetCameraFOV(0, 0.0);
  281.     EndCutScene();
  282.     ClearActorFlags(player, 0x200000);
  283.     probactive = 0; # reset
  284.     
  285.     return;
  286.  
  287. end
  288.  
  289.